/////////////////////////////////////////////////////////////////////////////////////
// Include Files
#include "ScriptSystem.h"
#include "ScriptNode.h"

//#include "Main\Game.h"

/////////////////////////////////////////////////////////////////////////////////////
// CScriptSystem Implementation
void IE::CScriptSystem::Initialize()
{
	// start the thread at 60 fps
	StartThread(60);
}

void IE::CScriptSystem::Shutdown()
{
	// stop the thread
	StopThread();
}

//void CScriptSystem::OnScriptStateAdd( CScriptStateEventArg &_rArg )
//{
//	// add the state to the list
//	CScriptState *pState = _rArg.GetState();
//	for( uint_t i = 0; i < m_lstScriptStates.GetSize(); ++i )
//	{
//		if( m_lstScriptStates[i] == CE_NULL )
//		{
//			m_lstScriptStates[i] = pState;
//			return;
//		}
//	}
//	m_lstScriptStates.Append(pState);
//}
//
//void CScriptSystem::OnScriptStateRemove( CScriptStateEventArg &_rArg )
//{
//	// remove the state from the list
//	CScriptState *pState = _rArg.GetState();
//	for( uint_t i = 0; i < m_lstScriptStates.GetSize(); ++i )
//	{
//		if( m_lstScriptStates[i] == pState )
//		{
//			m_lstScriptStates[i] = CE_NULL;
//			return;
//		}
//	}
//	assert(0);
//}

void IE::CScriptSystem::ThreadBegin()
{
	//// listen for script state events
	//AddEventListener(m_pGame->ScriptStateAdd, &CScriptSystem::OnScriptStateAdd);
	//AddEventListener(m_pGame->ScriptStateRemove, &CScriptSystem::OnScriptStateRemove);
}

void IE::CScriptSystem::ThreadEnd()
{
	//// stop listening for script state events
	//RemoveEventListener(m_pGame->ScriptStateAdd, &CScriptSystem::OnScriptStateAdd);
	//RemoveEventListener(m_pGame->ScriptStateRemove, &CScriptSystem::OnScriptStateRemove);
}

void IE::CScriptSystem::ThreadTick( float_t _fTime )
{
	(void)_fTime;

	//// check for events
	//ProcessEvents();
}
